package com.cardbaobao.cardbabyclient.ui.adapter;

import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.alibaba.android.vlayout.DelegateAdapter;
import com.alibaba.android.vlayout.LayoutHelper;
import com.cardbaobao.cardbabyclient.R;

import de.hdodenhof.circleimageview.CircleImageView;

/**
 * Created by Jiangzx on 14:20.
 */

public class HotRecCooperationDelegateAdapter extends DelegateAdapter.Adapter<RecyclerView.ViewHolder>{
    private LayoutHelper mLayoutHelper;
    public HotRecCooperationDelegateAdapter(LayoutHelper layoutHelper){
        mLayoutHelper=layoutHelper;
    }
    @Override
    public LayoutHelper onCreateLayoutHelper() {
        return mLayoutHelper;
    }

    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view= LayoutInflater.from(parent.getContext()).
                inflate(R.layout.item_image_text_subscript,parent,false);
        return new CooperationBankHolder(view);
    }

    @Override
    public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
        CooperationBankHolder bankHolder= (CooperationBankHolder) holder;
        bankHolder.tvSubscript.setText(String.valueOf(position));
        bankHolder.tvName.setText("银行"+position);
    }

    @Override
    public int getItemCount() {
        return 12;
    }


    @Override
    public int getItemViewType(int position) {
        return 3;
    }

    private class CooperationBankHolder extends RecyclerView.ViewHolder{
        private View root;
        private CircleImageView civLogo;
        private TextView tvSubscript;
        private TextView tvName;
        public CooperationBankHolder(View itemView) {
            super(itemView);
            root=itemView;
            civLogo= (CircleImageView) itemView.findViewById(R.id.iv_logo);
            tvSubscript= (TextView) itemView.findViewById(R.id.tv_subscript);
            tvName= (TextView) itemView.findViewById(R.id.tv_name);
        }
    }
}
